home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / tcl / tcl70b2.lha / tcl7.0b2 / doc / format.n < prev    next >
Text File  |  1993-07-17  |  3KB  |  73 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/format.n,v 1.2 93/07/17 15:39:01 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS format tcl
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. format \- Format a string in the style of sprintf
  29. .SH SYNOPSIS
  30. \fBformat \fIformatString \fR?\fIarg arg ...\fR?
  31. .BE
  32.  
  33. .SH DESCRIPTION
  34. .PP
  35. This command generates a formatted string in the same way as the
  36. ANSI C \fBsprintf\fR procedure (it uses \fBsprintf\fR in its
  37. implementation).
  38. \fIFormatString\fR indicates how to format the result, using
  39. \fB%\fR conversion specifiers as in \fBsprintf\fR, and the additional
  40. arguments, if any, provide values to be substituted into the result.
  41. Each \fIarg\fR must match the expected type
  42. from the corresponding conversion specifier in \fIformatString\fR;
  43. the \fBformat\fR command converts each argument to the correct
  44. type (floating, integer, etc.) before passing it to \fBsprintf\fR
  45. for formatting.
  46. The return value from \fBformat\fR is the formatted string.
  47. .PP
  48. .VS
  49. The conversion specifiers for \fBformat\fR are identical in syntax
  50. and effect to those for \fBsprintf\fR except for the following
  51. differences:
  52. .IP [1]
  53. \fB%p\fR and \fB%n\fR specifiers are not currently supported.
  54. .VE
  55. .IP [2]
  56. For \fB%c\fR conmversions the argument must be a decimal string,
  57. which will then be converted to the corresponding ASCII character value.
  58. .IP [3]
  59. .VS
  60. The \fBl\fR modifier is ignored;  integer values are always converted
  61. as if there were no modifier present and real values are always
  62. converted as if the \fBl\fR modifier were present (i.e. type
  63. \fBdouble\fR is used for the internal representation).
  64. If the \fBh\fR modifier is specified then integer values are truncated
  65. to \fBshort\fR before conversion.
  66. .PP
  67. The \fBformat\fR command also supports the XPG3 ``%n$'' positional
  68. specifiers.
  69. .VE
  70.  
  71. .SH KEYWORDS
  72. format, sprintf, string, substitution
  73.